package cn.tedu.api;

import java.util.Arrays;

public class TestString4 {
    public static void main(String[] args) {
        char[] c={'a','b','c','b','d','b'};
        String s1=new String(c);
        String s2="abcbdb";
        String s3="abcb";

        System.out.println("____________________");
        System.out.println(s1.hashCode());//-1424387906
        System.out.println(s2.hashCode());//-1424387906
        System.out.println(s3.hashCode());//2987074

        System.out.println("____________________");
        System.out.println(s1.equals(s2));//true
        System.out.println(s2.equals(s3));//false

        System.out.println(s1.toString());//abcbdb
        System.out.println(s1);//abcbdb
        System.out.println(s1.length());//6
        System.out.println("____________________");


        System.out.println(s1.toUpperCase());//ABCBDB
        System.out.println(s1.toLowerCase());//abcbdb
        System.out.println(s1.startsWith("a"));//true
        System.out.println(s1.endsWith("b"));//true
        System.out.println(s1.charAt(2));//c
        System.out.println("____________________");

        System.out.println(s2.indexOf("c"));//2
        System.out.println(s2.lastIndexOf("b"));//5
        System.out.println(s3.concat("dbeb"));//abcbdbeb
        String s4=s3.concat("sfsdsfxd");
        System.out.println(s4);//abcbsfsdsfxd

        System.out.println("____________________");
        System.out.println(Arrays.toString(s2.split("b")));//[a, c, d]
        String s5="   a   b   c   ";
        System.out.println(s5.trim());//a   b   c
        String s6="cdnfsjhgvfuy";
        System.out.println(s6.substring(3));//fsjhgvfuy
        System.out.println(s6.substring(3,8));//fsjhg

        System.out.println("____________________");
        System.out.println(String.valueOf(21));//21
        System.out.println("20"+21);//2021
        System.out.println(20+21);//41
        System.out.println(String.valueOf(30)+60);//3060



    }
}


